jQuery(function(){
	var menu = $j('#menu').val();
	var submenu = $j('#submenu').val();
	$j(".main_nav li").each(function(){
		var name=$j(this).attr("name");
		if(name==menu || name==submenu){
			$j(this).addClass("current");
		}
		else{
			$j(this).removeClass("current");
		}
	})
}
)

function clickMenu(e){
	clickMenuByForm(e,"menuForm");
}

function clickMenuByForm(e, formid){
    var form = document.getElementById(formid);
    $j("#" + formid).attr("action", $j(e).attr("url"));
    $j("#" + formid).append('<input type="hidden" name="orgId" value='+$j("#orgId").val()+'>');
    if ($j(e).attr("oldsongParam")) {
        var elementIds = $j(e).attr("oldsongParam").split(",");
        for (var i = 0; i < elementIds.length; i++) {
            $j("#" + formid).append($j('<input type="hidden" name=' + elementIds[i] + '>').val($j(e).attr(elementIds[i])));
        }
    }
    alert("Action:"+url+"\n"+$j(form).html());  
    form.submit();
}

function submitForm(form){
	if($j("#orgId").val()){
		$j(form).append('<input type="hidden" name="orgId" value='+$j("#orgId").val()+'>');
	}
    form.submit();
}